/*
* This file is part of Project SkyFire https://www.projectskyfire.org.
* See LICENSE.md file for Copyright information
*/

#ifndef SKYFIRESERVER_AREATRIGGER_H
#define SKYFIRESERVER_AREATRIGGER_H

#include "Object.h"

class Unit;
class SpellInfo;

class AreaTrigger : public WorldObject, public GridObject<AreaTrigger>
{
public:
    AreaTrigger();
    ~AreaTrigger() { }

    void AddToWorld();
    void RemoveFromWorld();

    bool CreateAreaTrigger(uint32 guidlow, uint32 triggerEntry, Unit* caster, SpellInfo const* spell, Position const& pos);
    void Update(uint32 p_time);
    void Remove();
    uint32 GetSpellId() const { return GetUInt32Value(AREATRIGGER_FIELD_SPELL_ID); }
    int32 GetDuration() const { return _duration; }
    void SetDuration(int32 newDuration) { _duration = newDuration; }
    void Delay(int32 delaytime) { SetDuration(GetDuration() - delaytime); }

protected:
    int32 _duration;
};
#endif
